String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } String.prototype.trimLeft = function() { return this.replace(/^\s+/,""); } String.prototype.trimRight = function() { return this.replace(/\s+$/,""); } //Demos file list (in order of presentation) //THe page name is formed from the file name. var fileList = [ 'Basic_swipe.html', 'Single_swipe.html', 'Any_finger_swipe.html', 'Finger_swipe.html', 'Swipe_status.html', 'Pinch.html', 'Pinch_status.html', 'Pinch_and_Swipe.html', 'Trigger_handlers.html', 'Stop_propagation.html', 'Handlers_and_events.html', 'Tap_vs_swipe.html', 'Hold.html', 'Excluded_children.html', 'Page_zoom.html', 'Thresholds.html', 'Enable_and_destroy.html', 'Page_scrolling.html', 'Options.html', 'Image_gallery_example.html' ]; /** * Builds the demo page */ function init() { buildTitle(); buildCodeExample(); buildNavigation(); } /** * Creates the navigation components */ function buildNavigation() { $('.navigation').each(function( index ) { $(this).html( getNavigation() ); }); $('.navigation_menu').each(function( index ) { $(this).html( getNavigationMenu() ); }) $('.navigation_list').each(function( index ) { $(this).html( getNavigationList() ); }) $('#menu').change( function() { location.href=$(this).val(); }); $('#menu li').click( function() { location.href=$(this).val(); }); $('.example_btn').click( function() { $(document).scrollTop( $("#test").offset().top ); }); $('.events code').click( function() { location.href = '../docs/%24.fn.swipe.html#event:' + $(this).text(); }); $('.properties code').click( function() { location.href = '../docs/%24.fn.swipe.defaults.html#' + $(this).text(); }); $('.methods code').click( function() { location.href = '../docs/%24.fn.swipe.html#' + $(this).text(); }); } /** * Builds the title element */ function buildTitle() { $('.title').each(function( index ) { $(this).html( getTitle() ); }) } /** * Copies the