PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/themes/ignitebend/javascript/k2_004.js

https://github.com/aeschright/openconferenceware
JavaScript | 122 lines | 91 code | 25 blank | 6 comment | 24 complexity | 2adb895ab4daab169adb28e42c7eb64b MD5 | raw file
  1. jQuery.noConflict();
  2. if (typeof K2 == 'undefined') var K2 = {};
  3. K2.debug = false;
  4. K2.ajaxGet = function(url, data, complete_fn) {
  5. jQuery.ajax({
  6. url: url,
  7. data: data,
  8. error: function(request) {
  9. jQuery('#notices')
  10. .show()
  11. .append('<p class="alert">Error ' + request.status + ': ' + request.statusText + '</p>');
  12. },
  13. success: function() {
  14. jQuery('#notices').hide().html();
  15. },
  16. complete: function(request) {
  17. // Disable obtrusive document.write
  18. document.write = function(str) {};
  19. if ( K2.debug ) {
  20. console.log(request);
  21. }
  22. if ( complete_fn ) {
  23. complete_fn( request.responseText );
  24. }
  25. // Lightbox v2.03.3 - Adds new images to lightbox
  26. if (typeof myLightbox != "undefined" && myLightbox instanceof Lightbox && myLightbox.updateImageList) {
  27. myLightbox.updateImageList();
  28. }
  29. }
  30. });
  31. }
  32. function OnLoadUtils() {
  33. jQuery('#comment-personaldetails').hide();
  34. jQuery('#showinfo').show();
  35. jQuery('#hideinfo').hide();
  36. };
  37. function ShowUtils() {
  38. jQuery('#comment-personaldetails').slideDown();
  39. jQuery('#showinfo').hide();
  40. jQuery('#hideinfo').show();
  41. };
  42. function HideUtils() {
  43. jQuery('#comment-personaldetails').slideUp();
  44. jQuery('#showinfo').show();
  45. jQuery('#hideinfo').hide();
  46. };
  47. // Manipulation of cookies (credit: http://www.webreference.com/js/column8/functions.html)
  48. function setCookie(name, value, expires, path, domain, secure) {
  49. var curCookie = name + "=" + escape(value) +
  50. ((expires) ? "; expires=" + expires.toGMTString() : "") +
  51. ((path) ? "; path=" + path : "") +
  52. ((domain) ? "; domain=" + domain : "") +
  53. ((secure) ? "; secure" : "");
  54. document.cookie = curCookie;
  55. };
  56. function getCookie(name) {
  57. var dc = document.cookie;
  58. var prefix = name + "=";
  59. var begin = dc.indexOf("; " + prefix);
  60. if (begin == -1) {
  61. begin = dc.indexOf(prefix);
  62. if (begin != 0) return null;
  63. } else
  64. begin += 2;
  65. var end = document.cookie.indexOf(";", begin);
  66. if (end == -1)
  67. end = dc.length;
  68. return unescape(dc.substring(begin + prefix.length, end));
  69. };
  70. function deleteCookie(name, path, domain) {
  71. if (getCookie(name)) {
  72. document.cookie = name + "=" +
  73. ((path) ? "; path=" + path : "") +
  74. ((domain) ? "; domain=" + domain : "") +
  75. "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  76. }
  77. };
  78. /* Fix the position of an element when it is about to be scrolled off-screen */
  79. function smartPosition(obj) {
  80. // Detect if content is being scroll offscreen.
  81. if ( (document.documentElement.scrollTop || document.body.scrollTop) >= jQuery(obj).offset().top) {
  82. jQuery('body').addClass('smartposition');
  83. } else {
  84. jQuery('body').removeClass('smartposition');
  85. }
  86. };
  87. // Set the number of columns based on window size and maximum set by K2 Options
  88. function dynamicColumns() {
  89. var window_width = jQuery(window).width();
  90. if (K2.columns >= 3 && window_width >= K2.layoutWidths[2]) {
  91. jQuery('body').removeClass('columns-one columns-two').addClass('columns-three');
  92. } else if (K2.columns >= 2 && window_width >= K2.layoutWidths[1]) {
  93. jQuery('body').removeClass('columns-one columns-three').addClass('columns-two');
  94. } else {
  95. jQuery('body').removeClass('columns-two columns-three').addClass('columns-one');
  96. }
  97. };