demo.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*!
  2. * Scripts for the demo pages on the jScrollPane website.
  3. *
  4. * You do not need to include this script or use it on your site.
  5. *
  6. * Copyright (c) 2010 Kelvin Luck
  7. * Dual licensed under the MIT and GPL licenses.
  8. */
  9. $(function()
  10. {
  11. // Copy the pages javascript sourcecode to the display block on the page for easy viewing...
  12. var sourcecodeDisplay = $('#sourcecode-display');
  13. if (sourcecodeDisplay.length) {
  14. sourcecodeDisplay.empty().append(
  15. $('<code />').append(
  16. $('<pre />').html(
  17. $('#sourcecode').html().replace(/\n\t\t\t/gm, '\n').replace('>', '&gt;').replace('<', '&lt;')
  18. )
  19. )
  20. );
  21. $('#css-display').empty().append(
  22. $('<code />').append(
  23. $('<pre />').html(
  24. $('#page-css').html().replace(/\n\t\t\t/gm, '\n')
  25. )
  26. )
  27. );
  28. }
  29. });
  30. // It seems some people copy this file and put it on their sites despite the message at the top
  31. // So let's make sure they don't end up in my stats...
  32. if (window.location.hostname == 'jscrollpane.kelvinluck.com') {
  33. // Google analytics tracking code for demo site
  34. var _gaq = _gaq || [];
  35. _gaq.push(['_setAccount', 'UA-17828883-1']);
  36. _gaq.push(['_trackPageview']);
  37. (function() {
  38. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  39. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  40. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  41. })();
  42. } else if(window.location.protocol == 'file:') {
  43. // Allow local testing without annoying alerts
  44. } else {
  45. alert('Do not include demo.js on your site!');
  46. }