12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- function init() {
- buildCodeExample();
- buildNavigation();
- }
- function buildNavigation() {
- $('.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();
- });
- }
- function buildCodeExample() {
- $('.prettyprint').each(function( index ) {
-
- var src = $("#"+$(this).attr('data-src')).html();
- if(src) {
- var lines = src.split("\n");
- var trimedLines=[];
- var trimIndex=null;
- for (var i=0; i<lines.length; i++) {
- var line = lines[i];
- if(trimIndex===null) {
- var trimmed = line.trimLeft();
- if(line.length>0) {
- trimIndex = line.length - trimmed.length;
- }
- }
- if(line.length>0) {
-
- line = line.replace(/\t/g, ' ');
- trimedLines.push( line.substr(trimIndex) );
- }
- };
- var html = trimedLines.join("\n");
- $(this).text( html );
- }
- });
-
- }
- $(function() {
- init();
- });
|