1/*jslint regexp: true, nomen: true, undef: true, sloppy: true, eqeq: true, vars: true, white: true, plusplus: true, maxerr: 50, indent: 4 */ 2/*global snw_data*/ 3var snw_render; 4 5;(function($, window, document, undefined) { 6 snw_render = { 7 animate: function(li, method, speed, idx) { 8 setTimeout(function() { 9 if (method === "slideDown") { 10 li.slideDown(speed); 11 } else if (method === "fadeIn") { 12 li.fadeIn(speed); 13 } else { 14 li.show(); 15 } 16 }, ( speed / 4 ) * idx ); 17 }, 18 static: function() { 19 $(document).on("click", ".snw-li-item a.snw-item", function(e){ 20 $(this).prev().find("a").click(); 21 }); 22 }, 23 init: function() { 24 $(document).on("click", "li.snw-li-expander a", function(e){ 25 e.preventDefault(); 26 27 var _settings = $(this).attr("href").substr(1).split("|"); 28 var snw_animate = _settings[7]; 29 var snw_speed = _settings[8]; 30 31 _settings[0] = parseInt(_settings[0]); 32 _settings[1] = parseInt(_settings[1]); 33 _settings[2] = parseInt(_settings[2]); 34 _settings[3] = parseInt(_settings[3]) + _settings[2]; 35 36 if (_settings[3] >= _settings[1]) { 37 if (_settings[3] > _settings[1] && _settings[0] > _settings[1]) { 38 var _loader = $(this).parent().next(); 39 $(this).parent().remove(); 40 _loader.fadeIn(snw_speed / 4); 41 42 $.ajax({
43 dataType: "html", type: "POST", 44 url: snw_data.ajax + "?action=snw_front_request", 45 data: { 46 _nonce: snw_data.nonce, 47 widget: _settings[4], 48 level: _settings[5], 49 offset: _settings[1], 50 value: _settings[6], 51 current: snw_data.current, 52 current_url: snw_data.current_url 53 }, 54 success: function(html) { 55 var _new_items = _loader.parent(), _counter = _settings[1]; 56 _loader.replaceWith(html); 57 58 _new_items.find("li.snw-li-item:hidden:lt(" + _settings[2] + ")").each(function(idx){ 59 snw_render.animate($(this), snw_animate, snw_speed, idx); 60 _counter++; 61 }); 62 63 if (_counter === _settings[0]) { 64 _new_items.find("li.snw-li-expander").fadeOut(snw_speed * 1.2); 65 } 66 } 67 }); 68 } else { 69 if ((_settings[3] > _settings[1]) || (_settings[3] === _settings[1] && _settings[1] === _settings[0])) { 70 $(this).parent().fadeOut(snw_speed * 1.2); 71 } 72 } 73 } 74 75 $(this).attr("href", "#" + _settings.join("|")); 76 77 $(this).parent().parent().find("li.snw-li-item.snw-li-level-" + _settings[5] + ":hidden:lt(" + _settings[2] + ")").each(function(idx){ 78 snw_render.animate($(this), snw_animate, snw_speed, idx); 79 }); 80 }); 81 82 $(document).on("click", "span.snw-item-toggle a", function(e) { 83 if ($(this).parent().hasClass("snw-item-toggle-parent")) { 84 window.location.href = $(this).attr("href"); 85 } 86 87 e.preventDefault(); 88 89 $(this).parent().toggleClass("snw-item-toggle-open"); 90 91 if ($(this).parent().hasClass("snw-item-toggle-open")) { 92 var ul = $(this).parent().next().next(); 93 ul.slideDown("500"); 94 95 if (!$(this).hasClass("snw-loading")) { 96 $(this).addClass("snw-loading"); 97 98 var options = $(this).attr("href").substr(1).split("|"); 99 100 $.ajax({
101 dataType: "html", type: "POST", 102 url: snw_data.ajax + "?action=snw_front_request", 103 data: { 104 _nonce: snw_data.nonce, 105 widget: options[0], 106 level: options[1], 107 offset: 0, 108 value: options[2], 109 current: snw_data.current, 110 current_url: snw_data.current_url 111 }, 112 success: function(html) { 113 ul.html(html); 114 115 if (ul.find(".snw-li-expander a").length > 0) { 116 ul.find(".snw-li-expander a").click(); 117 } else { 118 ul.find("li.snw-li-item:hidden").each(function(idx){ 119 snw_render.animate($(this), options[3], options[4], idx); 120 }); 121 } 122 } 123 }); 124 } 125 } else { 126 $(this).parent().next().next().slideUp(200); 127 } 128 }); 129 } 130 }; 131 132 $(document).ready(function() { 133 snw_render.init(); 134 135 if (snw_data.static) { 136 snw_render.static(); 137 } 138 }); 139})(jQuery, window, document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.