Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* Created by huntsper on 4/10/15.
*/
/*$('#pdf-and-forum-show').click(function(){
$('#pdf-and-forum').toggleClass('visible');
$('#pdf-and-forum-show').toggleClass("fa-caret-square-o-up fa-caret-square-o-down");
});*/
$('#feedback-show').click(function(){
$('#feedback').toggleClass('visible');
});
$('#toggle-contents').click(function(){
$('#toc').toggleClass('visible');
});
+1
View File
File diff suppressed because one or more lines are too long
+148
View File
@@ -0,0 +1,148 @@
/**
* functionality for language filtering
*/
var AWSDocs = AWSDocs || {};
AWSDocs.hasSectionMatch = function (selected) { // check to see if the cookie matches a filterable section on the page
var filterableEls = $(".langfilter");
for (var l = 0; l < filterableEls.length; l++) {
var filterableSection = filterableEls[l];
var filterableSectionName = $(filterableSection).attr("name");
if (filterableSectionName == selected) {
return true;
}
}
return false;
}
AWSDocs.filterContent = function (selected) {
var filterableEls = $(".langfilter");
var rightTocLinks = $("li.pagetoc");
var hasSectionMatch = (function () {
for (var l = 0; l < filterableEls.length; l++) {
var filterableSection = filterableEls[l];
var filterableSectionName = $(filterableSection).attr("name");
if (filterableSectionName == selected) {
return true;
}
}
return false;
})();
if (selected == "All") { // if the selected filter is "All", show all sections
filterableEls.show();
rightTocLinks.show();
}
else if ((selected !== "All") && (hasSectionMatch === false)) { // if the selected filter is not "All" and does NOT match a filterable section, show all sections
filterableEls.show();
rightTocLinks.show();
}
else { // if the selected filter is not "All" and DOES match a filterable section, show the section
for (var i = 0; i < filterableEls.length; i++) {
var filterableSection = filterableEls[i];
var filterableSectionName = $(filterableSection).attr("name");
if (filterableSectionName == selected) { // if a section is selected ...
$(filterableSection).show(); // show the section ...
if (rightTocLinks.length > 0) {
for (var j = 0; j < rightTocLinks.length; j++) {
if ($(rightTocLinks[j]).attr("name") == filterableSectionName) {
$(rightTocLinks[j]).show(); // and show the corresponding right ToC item
}
}
}
}
else { // if a section is not selected ...
$(filterableSection).hide(); // hide the section ...
if (rightTocLinks.length > 0) {
for (var j = 0; j < rightTocLinks.length; j++) {
if ($(rightTocLinks[j]).attr("name") == filterableSectionName) {
$(rightTocLinks[j]).hide(); // and hide the corresponding right ToC item
}
}
}
}
}
}
}
AWSDocs.setFilterCookie = function (cookieVal) {
document.cookie = "awsdocs_content_filter=" + encodeURIComponent(cookieVal);
}
AWSDocs.getFilterCookie = function () {
var awsDocsContentFilterCookieKey = "awsdocs_content_filter=";
var cookieArray = document.cookie.split(';');
for (var i = 0; i < cookieArray.length; i++) {
var cookie = cookieArray[i];
while (cookie.charAt(0) == ' ') { // get rid of spaces before the cookie value
cookie = cookie.substring(1, cookie.length);
}
if (cookie.indexOf(awsDocsContentFilterCookieKey) == 0) {
var cookieVal = decodeURIComponent(cookie.substring(awsDocsContentFilterCookieKey.length, cookie.length));
return cookieVal; // return the cookie value, or null if no cookie is set
}
}
return null;
}
AWSDocs.setupFilter = function () {
var cookieVal = AWSDocs.getFilterCookie();
if (cookieVal) {
if (AWSDocs.hasSectionMatch(cookieVal)) {
$("#filter-select").val(cookieVal);
} else {
$("#filter-select").val("All");
}
AWSDocs.filterContent(cookieVal); // if a cookie is available, filter with that value on page load
} else {
$("#filter-select").val("All");
}
$("#filter-select").change(function () {
var selected = $(this).val();
AWSDocs.setFilterCookie(selected);
AWSDocs.filterContent(selected); // filter again whenever an item is selected from the filter menu
});
}
$(document).ready(function () {
var filterableEls = $(".langfilter");
if (filterableEls.length > 0) { // check if there are filterable sections on the page ...
$("#language-filter").show(); // if so, show the filter menu and set up the filter
AWSDocs.setupFilter();
}
});
+97
View File
@@ -0,0 +1,97 @@
function toggleVisibility(linkObj)
{
var base = $(linkObj).attr('id');
var summary = $('#'+base+'-summary');
var content = $('#'+base+'-content');
var trigger = $('#'+base+'-trigger');
var src=$(trigger).attr('src');
if (content.is(':visible')===true) {
content.hide();
summary.show();
$(linkObj).addClass('closed').removeClass('opened');
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
content.show();
summary.hide();
$(linkObj).removeClass('closed').addClass('opened');
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
}
return false;
}
function updateStripes()
{
$('table.directory tr').
removeClass('even').filter(':visible:even').addClass('even');
}
function toggleLevel(level)
{
$('table.directory tr').each(function() {
var l = this.id.split('_').length-1;
var i = $('#img'+this.id.substring(3));
var a = $('#arr'+this.id.substring(3));
if (l<level+1) {
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
a.html('&#9660;');
$(this).show();
} else if (l==level+1) {
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
a.html('&#9658;');
$(this).show();
} else {
$(this).hide();
}
});
updateStripes();
}
function toggleFolder(id)
{
// the clicked row
var currentRow = $('#row_'+id);
// all rows after the clicked row
var rows = currentRow.nextAll("tr");
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
// only match elements AFTER this one (can't hide elements before)
var childRows = rows.filter(function() { return this.id.match(re); });
// first row is visible we are HIDING
if (childRows.filter(':first').is(':visible')===true) {
// replace down arrow by right arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
currentRowSpans.filter(".arrow").html('&#9658;');
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
} else { // we are SHOWING
// replace right arrow by down arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
currentRowSpans.filter(".arrow").html('&#9660;');
// replace down arrows by right arrows for child rows
var childRowsSpans = childRows.find("span");
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
childRowsSpans.filter(".arrow").html('&#9658;');
childRows.show(); //show all children
}
updateStripes();
}
function toggleInherit(id)
{
var rows = $('tr.inherit.'+id);
var img = $('tr.inherit_header.'+id+' img');
var src = $(img).attr('src');
if (rows.filter(':first').is(':visible')===true) {
rows.css('display','none');
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
rows.css('display','table-row'); // using show() causes jump in firefox
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
}
}
+12
View File
@@ -0,0 +1,12 @@
var AWSDocs = AWSDocs || {};
AWSDocs.feedbackOnload = function () {
var myPage = top.document.location.search.substr(1);
if (myPage.length > 0) {
var docfile = myPage.match(/topic_url=([^=\;\"#\?\s]+)/);
if (docfile.length == 2) {
var fblink = document.getElementById("fblink");
fblink.href = fblink.href + "&topic_url=" + docfile[1];
}
}
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+13
View File
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+5
View File
File diff suppressed because one or more lines are too long
+48
View File
@@ -0,0 +1,48 @@
function doFilterOnLoad(){
var filterValue = getFilterCookie();
if(filterValue!=null){
filterValue = getFilterCookie();
doFilter(filterValue);
document.getElementById('filter-select').value = filterValue;
}
}
function doFilter(value){
var elements;
setFilterCookie(value);
var filterN = 0;
var f=0;
for (filterN = 0; filterN<filterNames.length; filterN++){
var elements = document.getElementsByName(filterNames[filterN]);
if(value == filterNames[filterN] || value == 'All'){
for (f=0; f != elements.length; f++) {
elements[f].style.display='inline';
}
}
else{
for (f=0; f != elements.length; f++) {
elements[f].style.display='none';
}
}
}
}
function setFilterCookie(value){
document.cookie = "aws_lang_filter" + "=" + escape(value);
}
function getFilterCookie(){
var dc = document.cookie;
var prefix = "aws_lang_filter" + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0)
return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}
+126
View File
@@ -0,0 +1,126 @@
$(document).ready(function ()
{
// check language cookie early on in case we need to reload the correct page
CheckLanguageCookie();
CheckRegistrationCookie();
});
function SetCookie(name, value, session)
{
var days = 14;
var d = new Date();
// set expire date to milliseconds
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
if (session == 1){
document.cookie = name + "=" + value + ";path=/";
}
else {
document.cookie = name + "=" + value + ";expires=" + d.toUTCString() + ";path=/";
}
}
function CheckRegistrationCookie()
{
var regCookieName = "regStatus";
var regCookieValue = getCookie(regCookieName);
if(regCookieValue=="pre-register")
{
$('#span-conosole-signin').css('display','none');
$('#span-conosole-signup').css('display','inline');
}
else
{
$('#span-conosole-signin').css('display','inline');
$('#span-conosole-signup').css('display','none');
}
}
function CheckLanguageCookie()
{
try
{
var languageCookieName = "aws-doc-lang";
var languageCookieValue = getCookie(languageCookieName);
var currentSelectorUrl = $("#languageSelection").val();
var pageLocale = currentSelectorUrl.substring(1, 6);
var pageBasePath = currentSelectorUrl.substring(6);
var cookieUrl = "/" + languageCookieValue + pageBasePath;
var currentUrl = location.href;
var pathIndex = currentUrl.indexOf(pageBasePath);
if (pathIndex >= 6)
{
var startIndex = pathIndex - 5;
var urlLocale = currentUrl.substring(startIndex, pathIndex);
var urlLocaleStart = currentUrl.substring(startIndex - 1, startIndex);
// Check if this page is in locale folder...
if ((urlLocaleStart == "/") && (urlLocale.substring(2, 3) == "_"))
{
// Locale Folder Handling Section
// Check if the locale of the content and the locale folder agreee
if (pageLocale != urlLocale)
{
//var currentSelection = $('option:selected', 'select[id="languageSelection"]');
//var displayText = " Translation Unavailable (Displaying: " + currentSelection.text() + ")";
// remove selected attribute from the currently selected option
//currentSelection.removeAttr('selected');
// add option that captures the preferred language and display language
//$("#languageSelection").append($("<option selected=\"selected\" enabled=\"false\">" + displayText + "</option>"));
}
}
else
{
// Root Folder Handling Section
// Normally taken care of by the server, but checking in case of a cached version is being displayed.
if ((languageCookieValue != "") && (languageCookieValue != pageLocale))
{
location.href = cookieUrl;
}
}
}
// check if cookie is set
if (languageCookieValue.length == 5)
{
var cookieOption = $('select[id="languageSelection"]').find('option[value="' + cookieUrl + '"]');
// refresh cookie
SetCookie(languageCookieName, languageCookieValue, 0);
// Add checkmark to the language specified by the cookie...
cookieOption.html(cookieOption.text() + "&nbsp;&#10003;");
}
}
catch (error)
{
// content does not support the language selector.
}
}
function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++)
{
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1);
if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
}
return "";
}
+195
View File
@@ -0,0 +1,195 @@
/**
* interactivity for the left ToC
*/
var AWSDocs = AWSDocs || {
};
$(document).ready(function () {
$("li.awstoc.closed ul").hide();
$("li.awstoc").bind("click", function (event) {
event.stopPropagation();
if (event.target.nodeName == "LI") {
if ($(event.target).hasClass("closed") || $(event.target).hasClass("opened")) {
$(event.target).toggleClass("closed opened");
if ($(event.target).hasClass("closed")) {
$(event.target).children("ul").hide();
}
if ($(event.target).hasClass("opened")) {
$(event.target).children("ul").show();
}
}
}
});
//if toc scroll cookies set, use that to set current page toc scroll position
AWSDocs.setTocScroll();
$("#search-icon").click(AWSDocs.resizeSearchQueryBox);
var ua = navigator.userAgent.toLowerCase();
var mobile = (ua.indexOf("mobile") != -1);
if (! mobile) {
mobile = (ua.indexOf("silk") != -1);
}
if (! mobile) {
$("#left-column").resizable({
handles: "e"
});
}
AWSDocs.resizePanes();
window.onresize = AWSDocs.resizePanes;
// Need to handle unfixing top nav for silk browsers here for better zooming experience
if (ua.indexOf("silk") != -1) {
$("#aws-nav").css("position", "relative");
$("#content-container").css("margin-top", "0px");
}
});
$(window).unload (function () {
//set toc cookies before leaving page
AWSDocs.setTocCookies();
});
AWSDocs.setTocCookies = function () {
var currentUrl = window.location.href;
currentUrl = currentUrl.split('#').pop().split('?').pop();
var fileName = currentUrl.substring(currentUrl.lastIndexOf('/') + 1);
var urlPathIndex = currentUrl.indexOf(fileName);
var urlMatchString = currentUrl.substring(0, urlPathIndex);
//using setCookie from locale-selector.js
//set toc scroll position cookie for next page load
SetCookie ("aws-doc-toc-pos", $("#left-column").scrollTop(), 0);
//set url cookie to determine if toc scroll position will be valid
SetCookie ("aws-doc-toc-url", urlMatchString, 0);
}
AWSDocs.setTocScroll = function () {
try {
//using getCookie from locale-selector.js
var tocCookieName = "aws-doc-toc-pos";
var tocCookieValue = getCookie(tocCookieName);
var urlCookieName = "aws-doc-toc-url";
var urlCookieValue = getCookie(urlCookieName);
var currentLocation = window.location.href;
//get filename from url (remove query strings or anchors from url first)
currentLocation = currentLocation.split('#').pop().split('?').pop();
var fileName = currentLocation.substring(currentLocation.lastIndexOf('/') + 1);
var currentUrlPathIndex = currentLocation.indexOf(fileName);
var currentUrlPath = currentLocation.substring(0, currentUrlPathIndex);
// check if both cookies are set
if (tocCookieValue.length !== null && urlCookieValue.length !== null) {
//only reset the scroll top value if we're in the same guide
//otherwise, toc will be different and scroll value may not be valid
if (currentUrlPath === urlCookieValue) {
$("#left-column").scrollTop(tocCookieValue);
}
}
}
catch (error) {
//nothing to do - the toc scroll will be set to position 0
}
}
AWSDocs.resizePanes = function () {
var $leftCol = $("#left-column");
var leftWidth = $("#left-column").width();
var $mainCol = $("#main-column");
var $main = $("#main");
var leftColPosition = $("#left-column").position();
if ((leftWidth !== null || ("fixed" == leftColPosition))) {
leftWidthInPx = leftWidth + "px";
$mainCol.css("margin-left", leftWidthInPx);
}
// determine if tables on this page need to enable popup to show full width
var containerWidth = $("div#main-col-body").width();
$("div.table table").each(function () {
var tblWidth = $(this).width();
var divTableContent = $(this).parent();
var divId = $(this)[0].getAttribute("id");
var divClasses = divTableContent[0].getAttribute("class");
// if table width is wider than the container width, set up colorbox for popup
if (tblWidth > containerWidth) {
if (divTableContent.siblings("i.table-expand-icon").length == 0) {
divTableContent.after("<i class='fa fa-expand table-expand-icon' href='#" + divId + "'></i>");
divTableContent.siblings("i.table-expand-icon").colorbox({
maxWidth: "95%",
maxHeight: "95%",
inline: true,
className: divClasses
});
}
//set the height and position of the i element to be right next to the table div
var expandIcon = divTableContent.siblings("i.table-expand-icon");
var tblContentPos = divTableContent.position();
expandIcon.css({top: tblContentPos.top});
}
else {
//remove colorbox settings from this table (this is for when user resizes window to be bigger)
$(this).removeClass("cboxElement");
var divTable = $(this).parent();
if (divTable.siblings("i.table-expand-icon").length > 0) {
divTable.siblings("i.table-expand-icon").remove();
}
}
});
$("div.informaltable table").each(function () {
var tblWidth = $(this).width();
var divTableContent = $(this).parent();
var divId = $(this)[0].getAttribute("id");
var divClasses = divTableContent.parent()[0].getAttribute("class");
// if table width is wider than the container width, set up colorbox for popup
if (tblWidth > containerWidth) {
if (divTableContent.siblings("i.table-expand-icon").length == 0) {
divTableContent.after("<i class='fa fa-expand table-expand-icon' href='#" + divId + "'></i>");
divTableContent.siblings("i.table-expand-icon").colorbox({
maxWidth: "95%",
maxHeight: "95%",
inline: true,
className: divClasses
});
}
//set the height and position of the i element to be right next to the table div
var expandIcon = divTableContent.siblings("i.table-expand-icon");
var tblContentPos = divTableContent.position();
expandIcon.css({top: tblContentPos.top});
}
else {
//remove colorbox settings from this table (this is for when user resizes window to be bigger)
$(this).removeClass("cboxElement");
var divTable = $(this).parent();
if (divTable.siblings("i.table-expand-icon").length > 0) {
divTable.siblings("i.table-expand-icon").remove();
}
}
});
}
AWSDocs.resizeSearchQueryBox = function () {
$("#finegrainedSearch").toggle();
//$("#search-query").width($("#left-col-top-content").width() - 27);
}
+120
View File
@@ -0,0 +1,120 @@
/**
* general-purpose scripts that don't require a separate file
*/
var AWSDocs = AWSDocs || {
};
// adjusts position of the :target, so that the heading is not obscured by the fixed top nav
AWSDocs.adjustFragmentUrl = function () {
var hashUrl = window.location.hash.replace("#", "");
// remove # since not all browsers return it
var sanitizedHash = AWSDocs.sanitizeHash(hashUrl);
if (window.location.hash) {
var matchingFragment = $("body").find("#" + sanitizedHash + ":first");
if (matchingFragment.length) {
// this should always be true, but we'll check for safety
var scrollTo = $("#" + sanitizedHash).offset().top - 70;
$("html, body").animate({
scrollTop: scrollTo
},
"fast");
}
}
};
AWSDocs.sanitizeHash = function (hash) {
return encodeURIComponent(hash).replace(/(:|\.|\[|\]|,)/g, "\\$1");
// see http://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/
}
$(document).ready(function () {
//determine if footer cookie set
var footerShort = getCookie("aws-doc-footer-short");
if (footerShort === '1') {
if ($('#footer_short_fb').length) {
$('#footer').addClass('shortFooter_ht');
} else {
$('#footer').addClass('shortFooter');
}
$('#footer_toggle_img').toggleClass("hide");
$('#footer_toggle_img_collapse').toggleClass("hide");
$('#footer_short_fb').toggleClass("hide");
}
//watch for click events to add the footer state for site catalyst tracking
$("a[href]").click(function (event) {
var paramValue = "shortFooter=true";
// if short footer is visible and href is in the doc domain =
if ($('#footer_toggle_img.hide').length && this.href.indexOf(window.location.hostname.toString()) !== -1) {
//if href doesn't already contain the shortfooter param, add it
if (this.href.indexOf(paramValue) < 0) {
// Add footer param to url
var paramSeparator = this.href.indexOf("?") !== -1 ? "&": "?";
var hash = this.hash;
var url = this.href;
url = url.replace(hash, '');
this.href = url + paramSeparator + paramValue + hash;
}
} else {
//shortfooter param should be removed if it's in the url
if (this.href.indexOf(paramValue) > 0 && this.href.indexOf("?") > 0) {
//footer widened, remove shortFooter
var url = this.href;
var hash = this.hash;
url = url.replace(hash, '');
var urlprefix = url.split("?")[0];
var allParams = url.split("?")[1];
paramList = allParams.split("&");
for (var i = paramList.length -1; i>=0; i--) {
if(paramList[i] === paramValue) {
paramList.splice(i, 1); //remove the short footer param
}
}
if (paramList.length > 0){
this.href = urlprefix + "?" + paramList.join("&") + hash;
}
else {
this.href = urlprefix + hash;
}
}
}
});
// on click of the ellipsis (#toggle-contents), toggle the left ToC display from 'none' to 'block'
$('#toggle-contents').click(function () {
$('#toc').toggleClass("open");
});
$('#footer_toggle').click(function () {
$('#footer_toggle_img').toggleClass("hide");
$('#footer_toggle_img_collapse').toggleClass("hide");
$('#footer_short_fb').toggleClass("hide");
if ($('#footer_toggle_img.hide').length) {
if ($('#footer_short_fb').length) {
$('#footer').addClass('shortFooter_ht');
} else {
$('#footer').addClass('shortFooter');
}
SetCookie("aws-doc-footer-short", "1", 1);
}
if ($('#footer_toggle_img_collapse.hide').length) {
if ($('#footer_short_fb').length) {
$('#footer').removeClass('shortFooter_ht');
} else {
$('#footer').removeClass('shortFooter');
}
SetCookie("aws-doc-footer-short", "0", 1);
}
});
});
+77
View File
@@ -0,0 +1,77 @@
/**
* interactivity for the right, page-level ToC
*/
var AWSDocs = AWSDocs || {};
AWSDocs.rightNavLinks;
AWSDocs.sections;
$(document).ready(function () {
/*
* When a fragment target is selected in the right nav, clear style for the previous
* selection and apply style for the new selection. The style highlights
* the selected link.
*/
$("a.pagetoc").click(function () {
$("a.pagetoc.selected").removeClass("selected");
$(this).addClass("selected");
var currentHref = $(this).attr( "href" );
var hashUrl = window.location.hash.replace("#", "");
if(currentHref == ("#" + hashUrl)) {
AWSDocs.adjustFragmentUrl();
}
});
AWSDocs.rightNavLinks = $("a.pagetoc");
AWSDocs.sections = $("h2");
});
AWSDocs.isElementInViewport = function (element) {
var rect = element.getBoundingClientRect();
return (
rect.top >= 0 && // see if the top of the element is below the top of the viewport
rect.bottom <= $(window).height() // see if the bottom of the element is above the bottom of the viewport
);
}
$(window).on('DOMContentLoaded load resize scroll', function () {
if (AWSDocs.sections) {
var numSections = AWSDocs.sections.length; // get total number of H2 sections on the page
for (var i = 0; i < numSections; i++) {
var sec = AWSDocs.sections[i];
var docBottom = $(document).height() - $(window).height() - $(window).scrollTop();
if (docBottom == 0) { // if we're at the bottom of the document
$("a.pagetoc.selected").removeClass("selected"); // remove "selected" from all pagetoc links
$( AWSDocs.rightNavLinks[numSections - 1] ).addClass("selected"); // and add it to the LAST pagetoc link
}
else if (AWSDocs.isElementInViewport(sec)) {
var sectionId = $(sec).attr("id");
for (var j = 0; j < AWSDocs.rightNavLinks.length; j++) {
var rightNavLinkTarget = $(AWSDocs.rightNavLinks[j]).attr("href").substr(1);
if (rightNavLinkTarget == sectionId) {
$(AWSDocs.rightNavLinks).removeClass("selected");
$(AWSDocs.rightNavLinks[j]).addClass("selected");
return;
}
}
}
}
}
});
+43
View File
@@ -0,0 +1,43 @@
function searchFormSubmit(formElement)
{
//#facet_doc_product=Amazon+CloudFront&amp;facet_doc_guide=Developer+Guide+(API+Version+2012-07-01)
var so = $("#search-select").val();
if (so.indexOf("documentation") === 0)
{
var this_doc_product = $("#this_doc_product").val();
var this_doc_guide = $("#this_doc_guide").val();
var action = "";
var facet = "";
if (so === "documentation-product" || so === "documentation-guide")
{
action += "?doc_product=" + encodeURIComponent(this_doc_product);
facet += "#facet_doc_product=" + encodeURIComponent(this_doc_product);
if (so === "documentation-guide")
{
action += "&doc_guide=" + encodeURIComponent(this_doc_guide);
facet += "&facet_doc_guide=" + encodeURIComponent(this_doc_guide);
}
}
var ua = window.navigator.userAgent;
var msie = ua.indexOf('MSIE ');
var trident = ua.indexOf('Trident/');
var edge = ua.indexOf('Edge/');
if (msie > 0 || trident > 0 || edge > 0)
{
var sq = $("#search-query").val();
action += "&searchPath=" + encodeURIComponent(so);
action += "&searchQuery=" + encodeURIComponent(sq);
window.location.href = "/search/doc-search.html" + action + facet;
return false;
} else
{
formElement.action = "/search/doc-search.html" + facet;
}
} else
{
formElement.action = "http://aws.amazon.com/search";
}
return true;
}
+16
View File
@@ -0,0 +1,16 @@
/**
* overrides and additional functionality for highlight.js
*/
$(document).ready(function() {
// apply highlighting to all <pre><code>..</code></pre> blocks on a page
if (typeof hljs !== "undefined") {
hljs.initHighlighting();
}
// remove css classes from nested code elements, to prevent funky styling
$('em.replaceable code, em.replaceable code span, a.xref code').removeClass();
$('code.nohighlight code, code.nohighlight span').removeClass();
});
+3
View File
@@ -0,0 +1,3 @@
QUnit.test( "hello test", function( assert ) {
assert.ok( 1 == "1", "Passed!" );
});
+184
View File
@@ -0,0 +1,184 @@
var AWSDocs = AWSDocs || {};
AWSDocs.Flyout = (function () {
var slideOpen = function ($trigger, $el) {
$trigger.addClass("active");
$el.show("slide", 300);
};
var keepOpen = function ($trigger, $el) {
$trigger.addClass("active");
$el.show();
};
var close = function ($trigger, $el) {
$trigger.removeClass("active");
$el.hide();
};
return {
slideOpen: slideOpen,
keepOpen: keepOpen,
close: close
};
})();
AWSDocs.TemplateCompiler = (function() {
var compileFlyout = function($flyoutTemplate, $flyout, flyoutData) {
if (typeof Handlebars !== "undefined"){
var rawHtml = $flyoutTemplate.html();
var template = Handlebars.compile(rawHtml); // 3) prepare the HTML template for execution ...
var context = flyoutData;
var renderedHtml = template(context); // 4) execute the template against the content ...
$flyoutTemplate.replaceWith(renderedHtml); // 5) inject the transformed content into the page ...
if ($flyout) {
$flyout.menu(); // 6) activate styling for flyout, AFTER we've built it
}
var $homeLink = $( "#ui-id-1" ); // 7) a hack to make the home flyout link work
if ($homeLink) {
$homeLink.click(function() {
window.location = flyoutData.flyoutList[0].topTarget;
});
}
}
};
var getFlyoutJson = function($flyoutTemplate, $flyout) {
var locale = $("meta[name=guide-locale]").attr("content");
var requestUrl = "/flyout.json"; // server request from server-root/js/awsdocs.min.js to server-root/flyout.js
if (typeof locale !== "undefined")
{
if(locale.length==5)
{
requestUrl = "/menu/" + locale + requestUrl;
}
else
{
// use default if we don't have a valid locale
requestUrl = "/menu" + requestUrl;
}
}
$.getJSON(requestUrl, function( flyoutData ) { // 2) retrieve the flyout content from the server
compileFlyout($flyoutTemplate, $flyout, flyoutData); // and pass on the template, flyout el, and JSON ...
})
};
var createFlyout = function($flyoutTemplate, $flyout) {
if ($flyoutTemplate) { // 1) if the template exists on the page ...
getFlyoutJson($flyoutTemplate, $flyout);
};
};
return {
createFlyout: createFlyout
};
})();
AWSDocs.Cookies = (function ()
{
var setCookie = function ($name, $value)
{
var days = 14;
var d = new Date();
// set expire date to milliseconds
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
document.cookie = $name + "=" + $value + ";expires=" + d.toUTCString() + ";path=/";
};
return {
setCookie: setCookie
};
})();
$(document).ready(function () {
var $hamburger = $("#aws-nav-flyout-trigger");
var $flyoutContainer = $("#topnav-flyout-menu-container");
var $flyout = $("#topnav-flyout-menu");
var $langSelector = $("#languageSelection");
var $flyoutTemplate = $( "#flyout-item-template" );
AWSDocs.TemplateCompiler.createFlyout($flyoutTemplate, $flyout);
if ($langSelector) {
// activate styling for language selector
$langSelector.selectmenu({
select: function (event, ui)
{
var languageCookieName = "aws-doc-lang";
var targetUrl = ui.item.value;
var selectedLanguage = targetUrl.substring(1, 6);
var d = new Date();
d.setTime(d.getTime() + (14 * 24 * 60 * 60 * 1000));
AWSDocs.Cookies.setCookie(languageCookieName, selectedLanguage);
if (location.href.indexOf(targetUrl) < 0)
{
location.href = targetUrl;
}
}
});
$( window ).resize(function() {
$langSelector.selectmenu( "close" );
});
}
if ($hamburger) {
$hamburger.mouseenter(
function ( event ) {
if (event.relatedTarget !== null && (event.relatedTarget.id == "ui-id-1" ||
event.relatedTarget.id == "awsdocs-flyout-first-a" ||
event.relatedTarget.id == "topnav-flyout-menu" )) { // see if we're entering from the flyout menu
AWSDocs.Flyout.keepOpen($hamburger, $flyoutContainer); // if we ARE entering from the flyout, don't slide open again
} else {
AWSDocs.Flyout.slideOpen($hamburger, $flyoutContainer);
}
}
);
$hamburger.mouseleave( // when the user mouses out of the $hamburger, collapse
function () {
AWSDocs.Flyout.close($hamburger, $flyoutContainer);
}
);
}
if ($flyoutContainer) {
$flyoutContainer.hover(
function () { // on mouseenter
AWSDocs.Flyout.keepOpen($hamburger, $flyoutContainer);
}, function () { // on mouseleave
AWSDocs.Flyout.close($hamburger, $flyoutContainer);
$flyout.menu("collapseAll");
}
);
}
});