<![CDATA[ IDENTITY.init(); // Load the structure $(window).on('load', function () { var configLoad = $.ajax({ type: 'GET', url: '/application/getIndexPage', contentType: 'application/json' }); // register for history events (html5 browsers only, basically IE10+ and everything else: http://caniuse.com/#search=pushstate) window.onpopstate = DEVELOPER.history_handler; // Get the sizing right DEVELOPER.resize_handler(); // When load completes render the html $.when(configLoad).then(function (conf, b, c) { // First render the header if (typeof conf.header === 'object') { if ($.isArray(conf.header.menu)) { // Add links to the header for (var lIdx = 0; lIdx < conf.header.menu.length; ++lIdx) { var currLink = conf.header.menu[lIdx]; $('#header_navigation').append($('
‘, { ‘style’: ‘width: 90px;’ }).append($(”, { ‘text’: currLink.label, ‘class’: ‘underline_link’, ‘data-section’: currLink.section, ‘href’: ‘javascript: DEVELOPER.navigate(“‘ + currLink.navigation + ‘”);’ }))); } } // Add body class $(‘body’).addClass(conf.header.body_class); // Set the tile style TILES.brand = conf.header.brand; if (typeof conf.user === ‘undefined’ || typeof conf.user.sid === ‘undefined’) { TILES.internal = false; } // Update the title $(‘title’).text(conf.header.site_name); // Persist the site name DEVELOPER.siteName = conf.header.site_name; // Update the header title $(‘#header-title’).text(conf.header.short_name); // Set the favicon if (typeof conf.header.favicon !== ‘undefined’) { $(‘[rel=”shortcut icon”]’).attr(‘href’, conf.header.favicon); } } // Render the footer if (typeof conf.footer !== ‘undefined’) { if ($.isArray(conf.footer.menu)) { // Add links to the footer for (var lIdx = conf.footer.menu.length – 1; lIdx >= 0; –lIdx) { var currLink = conf.footer.menu[lIdx]; $(‘footer .link-container’).prepend($(”, { ‘href’: currLink.url, ‘text’: currLink.label })); } } if (typeof conf.footer.copyright !== ‘undefined’) { $(‘footer .copyright’).html(conf.footer.copyright); } } // Get the sizing right DEVELOPER.resize_handler(); // we either are deep linking to a page or we are falling back to any defined solution // or content… var deeplink = location[‘pathname’]; if (typeof deeplink === ‘undefined’ || deeplink === ” || deeplink === ‘/’) { // make sure we record the url… DEVELOPER.record_history({url: ‘/’}, ‘/’); // render any solutions… if (typeof conf.solution !== ‘undefined’) { DEVELOPER.load_solution(conf.solution); } if (typeof conf.content !== ‘undefined’) { $(‘#stage’).html(conf.content); DEVELOPER.load_solution_title(); $(‘#stage’).show(); // Render the tiles… TILES.render_tiles(); } } else { // pass off navigation to global navigation… DEVELOPER.navigate(deeplink); } }).catch(function (err) { console.log(‘Error’, err); }); // all modal handling… // close modals after waiting two seconds var modalTimer; $(“.modal”).on(“mouseover”, function () { clearTimeout(modalTimer); }).on(“mouseleave”, function () { modalTimer = setTimeout(function (m) { $(m).removeClass(‘open’); }, 2000, this); }); // Click handlers $(‘body’).on(‘click’, ‘button.tile’, function (e) { // Ensure that you’re at the correct level var jTarget = $(e.target); jTarget = UTILS.thisOrClosest(jTarget, ‘.tile’); if (!jTarget.hasClass(’tile’)) { jTarget = jTarget.parents(‘.tile’); } if (typeof jTarget.attr(‘data-id’) !== ‘undefined’) { var type = ‘products’; if (jTarget.hasClass(‘solution-tile’)) { type = ‘solutions’; } DEVELOPER.navigate(type + ‘/’ + jTarget.attr(‘data-id’)); } }); $(‘body’).on(‘click’, ‘div.left-nav li’, function (e) { var jTarget = $(e.target).closest(‘li’); if (jTarget.attr(‘disabled’) === ‘disabled’) { return; } if ($(jTarget).children(‘.accordion-trigger’).length === 0) { $(jTarget).closest(‘div.left-nav’).find(‘li’).removeClass(‘active’); $(jTarget).addClass(‘active’); } else { $(jTarget).toggleClass(‘open’); } }); $(‘body’).on(‘click’, ‘.detail-page .detail-nav ul li:not(.disabled)’, function (e) { // this is responding to a click on the api detail page left navigation so we can assume that the // correct api detail page is loaded and that we are simply adjusting the page layout… var jTarget = $(e.target).closest(‘li’); var id = $(jTarget).attr(‘data-section’); var path = $(‘.detail-page’).attr(‘data-path’); var deep = $(jTarget).attr(‘data-path’); // we ignore any attempted navigation to erroneous menu items or the top level guides entry as it // is just a placeholder for the real guides… if (typeof id !== ‘undefined’ && id !== ‘guides’) { // highlight the menu item… $(jTarget).addClass(‘active’); DEVELOPER.set_product_mode(deep); // set the path for history… if (typeof deep !== ‘undefined’) { path += deep; } // set the path for history… DEVELOPER.record_history({url: path}, path); } }); $(‘body’).on(‘click’, ‘.detail-page .on-this-page ul li’, function (e) { var jTarget = $(e.target).closest(‘li’); var otp = $(jTarget).closest(‘.on-this-page’); $(otp).find(‘li’).removeClass(‘active’); $(jTarget).addClass(‘active’); var id = $(jTarget).attr(‘data-anchor-id’); if (typeof id != undefined) { var anchor = $(‘.detail-page .detail-content.active’).find(‘[data-anchor-target=”‘ + id + ‘”]’); var scrollable = $(anchor).closest(‘.detail-content-container’); if (typeof scrollable !== ‘undefined’) { DEVELOPER.scroll_to($(scrollable), anchor, 10, 500); } } }); }); // Log in function logIn() { window.location = ‘/login’; } // Register function register() { window.location = ‘/register/’; } ]]> Source
Related